<CFSET SESSION.TABLOCATION = "../../edtr/">
<cfset session.themessage = "">
<SCRIPT>
function SetRelationField(sFromValue, sToValue, sAssignValue, sRelatedFld, sDefault, oField) {
var aFrom, aTo, aAssign, nLen, nCnt, lInBetween=false

	aFrom=sFromValue.split(",")
	aTo=sToValue.split(",")
	aAssign=sAssignValue.split(",")
	nLen=aFrom.length

	for (nCnt=0; nCnt < nLen; nCnt++) {
		if (
			 (aFrom[nCnt] == "" && oField.value <= aTo[nCnt]) ||
			 (aTo[nCnt] == "" && oField.value >= aFrom[nCnt]) ||
			 (aFrom[nCnt] <= oField.value && oField.value <= aTo[nCnt])
		   )
		{
			eval("document.eForm.edt" + sRelatedFld + ".value='" + aAssign[nCnt] + "'")
			lInBetween=true
			break
		}
	}

	if (!lInBetween && sDefault != "")
		eval("document.eForm.edt" + sRelatedFld + ".value='" + sDefault + "'")
}

function ChangeTitle(sTitle, eAttachmentHandle) {
	if (eAttachmentHandle.document.title == "") {
		setTimeout("ChangeTitle(sTitle, eAttachmentHandle)", 1000)
		eAttachmentHandle.document.title=sTitle
	} else
		eAttachmentHandle.document.title=sTitle
}

function GetLastInput(oField) {
var sName=oField.name, nCnt, sChar, sDigit="0123456789",
	sSuffix="", nSuffix, sGivenName

	if (!oField.readonly && !oField.disabled)
	for (nCnt=sName.length; nCnt > 0; nCnt--) {
		sChar=sName.substring(nCnt, nCnt - 1)

		if (sDigit.indexOf(sChar) != -1)
			sSuffix=sChar + sSuffix
		else {
			sGivenName=sName.substring(0, nCnt)
			break
		}
	}


	if (sSuffix != "" && sSuffix != "1") {
		sSuffix=sSuffix - 1
		oField.value=eval("document.eForm." + sGivenName + sSuffix + ".value")
	}
}

function CheckeFormDate(oDate, dCutOff, sLateAppsMode) {
var dDate1, dDate2, lReturn=true

	with (oDate) {
		if (value != "" && !CheckDate(oDate)) {
			//alert("Invalid Date")
			value=""
			lReturn=false
		} else
			if (dCutOff != "") {
				dDate1=new Date(value)
				dDate2=new Date(dCutOff)

				if (sLateAppsMode == "1" && dDate1.valueOf() <= dDate2.valueOf()) {
					alert("Late Application is not accepted.")
					value=""
					lReturn=false
				} else
					if (sLateAppsMode == "2" && dDate1.valueOf() >= dDate2.valueOf()) {
						alert("Advance Application is not accepted.")
						value=""
						lReturn=false
					}
			}
	}

return(lReturn)
}
</SCRIPT>

<CFMODULE template="#CLIENT.COMMON_PATH#cfm_geturlvariables.cfm" REMOVEURL = "t,EDIT,DELETE,rs,newapp" >
<CFSET sFieldWthFormat="">
<CFSET EDTRCODE = DECRYPT(URL.id,CLIENT.EK)>

<CFQUERY NAME="getRECORD" DATASOURCE="#client.company_dsn#">
	SELECT A.TKFILENAME_FK, A.EDTRGROUP, A.SHAREDVIEW, A.SHAREDUPDATE, A.GROUPCODE, 
		B.CUTOFFSTARTDATE, B.CUTOFFENDDATE
	FROM ECRGDTR A, CRGTKFILES B
	WHERE EDTRCODE = <cfqueryparam value="#EDTRCODE#" cfsqltype="cf_sql_varchar">
		AND A.TKFILENAME_FK = B.TKFILENAME
</CFQUERY>
<CFIF getRECORD.RECORDCOUNT>
	<CFSET sTHETK = getRECORD.TKFILENAME_FK>
	<CFSET dCUTOFFSTART = GETRECORD.CUTOFFSTARTDATE>
	<CFSET dCUTOFFEND = GETRECORD.CUTOFFENDDATE>
<CFELSE>
	<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH="100%">
	<CFOUTPUT>
	<TR>
		<TD ALIGN="right"><IMG SRC="#client.image_path##session.site_ibose#"></TD>
		<TD NOWRAP CLASS="bold14" WIDTH="100%"><FONT FACE="Impact" SIZE="+2">#client.companyname#</FONT><BR>iBOS/e eDTR</TD>
	</TR>
	<TR height="100"> &nbsp; </TR>
	<TR> <TD colspan="100" align="center">The attendance file was not found. Please contact your administrator. </TD>	</TR>
	<TR> <TD><BUTTON onClick="javascript: self.close();"> CLOSE </BUTTON></TD> </TR>
	</CFOUTPUT>
	</TABLE>
	<CFABORT>
</CFIF>
<CFQUERY NAME = "getRECORDDTL" datasource="#CLIENT.COMPANY_DSN#">
	SELECT FORMCODE_FK, DATEFIELD
	FROM ECRGDTRDTL
	WHERE EDTRCODE = <cfqueryparam value="#EDTRCODE#" cfsqltype="cf_sql_varchar">
</CFQUERY>
<CFQUERY NAME = "getEFORMS" datasource="#CLIENT.COMPANY_DSN#">
	SELECT TABLENAME_FK, DESCRIPTION, PREPROCESS,FORMCODE
	FROM ECRGFORMS
	WHERE FORMCODE IN (<cfqueryparam value="#VALUELIST(GETRECORDDTL.FORMCODE_FK)#" cfsqltype="cf_sql_varchar" list="yes">)
</CFQUERY>
<html>
<head>
	<title>iBOS/e eDTR - Group eDTR</title>
<CFOUTPUT>
<LINK REL="StyleSheet" HREF="#client.wstheme_path##client.empcolor#.css" TYPE="text/css">
	</CFOUTPUT>
</head>
<body topmargin=0 rightmargin=0 leftmargin=0 bottommargin=0 bgcolor="#FFFFFF">
<CFMODULE TEMPLATE="#client.common_path#cfm_workspace.cfm" MODULE="DTR" COMPONENT = "eDTR updating" LOCATION = "../">
<CFOUTPUT>
<CFQUERY NAME = "qryEMPDETAILS" datasource="#CLIENT.COMPANY_DSN#">
	SELECT A.UNITCODE, A.PERSONNELBADGENO, A.LASTNAME, A.FIRSTNAME, 	
		A.MIDDLENAME,B.WORKSKEDCODE, C.DESCRIPTION
	FROM CMFPA A, CINWSMASTER B, CLKWORKSKED C
	WHERE A.PERSONNELIDNO = B.PERSONNELIDNO
		AND B.ACTIVESKED = 'Y'
		AND B.WORKSKEDCODE = C.WORKSKEDCODE
		AND A.PERSONNELIDNO = <cfqueryparam value="#PID#" cfsqltype="cf_sql_varchar">
</CFQUERY>
<CFQUERY name="qryECINDTRUPDATE" datasource="#CLIENT.COMPANY_DSN#">
	SELECT DOCNUMBER,APPROVED
	FROM ECINDTRUPDATE
	WHERE EDTRCODE_FK = <cfqueryparam value="#EDTRCODE#" cfsqltype="cf_sql_varchar">
		AND PERSONNELIDNO = <cfqueryparam value="#CLIENT.CHAPA#" cfsqltype="cf_sql_varchar">
		AND ROUTEID IS NULL
		AND (APPROVED NOT IN ('Y','N','C') OR APPROVED IS NULL)
</CFQUERY>
<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH="100%">
<tr>
<CFIF qryECINDTRUPDATE.RECORDCOUNT>
	<CFSET THEDOCNUMBER = qryECINDTRUPDATE.DOCNUMBER>
	<CFIF qryECINDTRUPDATE.APPROVED EQ "">
		<CFSET EDTRROUTED = FALSE>
	<TD>The eDTR Updating Form of #qryEMPDETAILS.LASTNAME#,#qryEMPDETAILS.FIRSTNAME# for this attendance cut-off is not yet routed (DOCNUMBER: #THEDOCNUMBER#)</TD>
	<CFELSE>
		<CFSET EDTRROUTED = TRUE>
	<TD>The eDTR Updating Form of #qryEMPDETAILS.LASTNAME#,#qryEMPDETAILS.FIRSTNAME# for this attendance cut-off is still on-process (DOCNUMBER: #THEDOCNUMBER#)</TD>
	</CFIF>
<CFELSE>
	<CFSET EDTRROUTED = FALSE>
	<CFMODULE TEMPLATE="#client.common_path#cfm_autogen_bose.cfm" TABLENAME = "ECINDTRUPDATE"
		COLUMNNAME = "DOCNUMBER" DATASOURCE="#client.company_dsn#">
	<CFSET THEDOCNUMBER = AUTOGENVALUE>
	<CFQUERY name="insertECINDTRUPDATE" datasource="#CLIENT.COMPANY_DSN#">
		INSERT INTO ECINDTRUPDATE(DOCNUMBER,GUID,PERSONNELIDNO,EDTRCODE_FK,RECCREATEDBY,RECDATECREATED)
		VALUES('#THEDOCNUMBER#','#CLIENT.GUID#','#CLIENT.CHAPA#','#EDTRCODE#','#CLIENT.USERID#',#NOW()#)
	</CFQUERY>
	<TD>The eDTR Updating Form of #qryEMPDETAILS.LASTNAME#,#qryEMPDETAILS.FIRSTNAME# for this attendance cut-off was given the DOCNUMBER: #THEDOCNUMBER#</TD>
</CFIF>
</tr>
</TABLE>
</CFOUTPUT>
	<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH="100%">
	<CFOUTPUT>
	<TR>
		<TD ALIGN="right">iBOS/e eDTR - Updating</TD>
	</TR>
		<TR>
				<TD align="center">
					FROM #DATEFORMAT(dCUTOFFSTART)# TO #DATEFORMAT(dCUTOFFEND)#
				</TD>
			</TR>
			<TR>
				<TD align="left">
					UNIT CODE: #qryEMPDETAILS.UNITCODE#
				</TD>
			</TR>
			<TR>
				<td align="left">
					EMPLOYEE NO.: #PID#
				</td>
			</TR>
			<TR>
				<td align="left">
					BADGE NO.: #qryEMPDETAILS.PERSONNELBADGENO#
				</td>
			</TR>
			<TR>
				<TD align="left">
					EMPLOYEE NAME: #qryEMPDETAILS.LASTNAME#, #qryEMPDETAILS.FIRSTNAME# #qryEMPDETAILS.MIDDLENAME#
				</TD>
			</TR>
			<TR>
				<TD align="left">
					SCHEDULE CODE: #qryEMPDETAILS.WORKSKEDCODE# - #qryEMPDETAILS.DESCRIPTION#
				</TD>
			</TR>
	</CFOUTPUT>
	</TABLE>
<CFIF STRUCTKEYEXISTS(URL,"T")>
	<CFSET THETABLE = URL.T>
<cfelseif STRUCTKEYEXISTS(URL,"newapp") and structkeyexists(form,"selapp")>
	<cfset thetable = form.selapp>
</CFIF>
<CFPARAM NAME = "THETABLE" DEFAULT = "#GETRECORD.TKFILENAME_FK#PX">
<CFSET STDB = "">
<CFIF THETABLE EQ "#GETRECORD.TKFILENAME_FK#PX">
	<CFIF LISTFINDNOCASE(VALUELIST(getRECORDDTL.FORMCODE_FK),"PX")>
		<CFSET THETITLE = "Attendance Exceptions">
	<cfelse>
		<CFSET THETITLE = "Attendance Exceptions">
	</CFIF>
	<CFQUERY NAME = "qryGRGTRANSACTION" datasource="#CLIENT.GLOBAL_DSN#">
	SELECT B.IBOSEDSN, B.DATABASENAME
	FROM GRGTRANSACTION A, GRGDATALOCATION B
	WHERE A.DATALOCATIONCODE = B.DATALOCATIONCODE
		AND A.COMPANYCODE = '#CLIENT.COMPANYCODE#'
	</CFQUERY>
	<CFLOOP QUERY = "qryGRGTRANSACTION">
		<CFTRY>
		<CFQUERY NAME = "qryFINDTRANDB" datasource="#IBOSEDSN#">
			SELECT NAME FROM SYSOBJECTS
			WHERE NAME = '#GETRECORD.TKFILENAME_FK#PX'
		</CFQUERY>
		<CFIF qryFINDTRANDB.RECORDCOUNT>
			<CFSET sTDB = IBOSEDSN>
			<CFSET sTHEDBNAME = DATABASENAME>
		<CFBREAK>
		</CFIF>
		<CFCATCH>
		</CFCATCH>
		</CFTRY>
	</CFLOOP>
</CFIF>
<CFOUTPUT>
<!---<CFQUERY NAME = "qryECRGFORMS" datasource="#CLIENT.COMPANY_DSN#">
	SELECT DISTINCT(TABLENAME_FK)
	FROM ECRGFORMS
	WHERE FORMCODE IN (#QUOTEDVALUELIST(GETRECORDDTL.FORMCODE_FK)#)
</CFQUERY>
<CFQUERY name="qryALLEFORMS" datasource="#CLIENT.COMPANY_DSN#">
	SELECT FORMCODE, DESCRIPTION
	FROM ECRGFORMS
	WHERE FORMCODE IN (#QUOTEDVALUELIST(GETRECORDDTL.FORMCODE_FK)#)
</CFQUERY>
<CFQUERY name="qryTABLEDESC" datasource="#CLIENT.GLOBAL_DSN#">
	SELECT TABLENAME,DESCRIPTION
	FROM GRGBOSETABLE
	WHERE TABLENAME IN (#QUOTEDVALUELIST(qryECRGFORMS.TABLENAME_FK)#)
</CFQUERY>--->
<table border=0 cellspacing=1 cellpadding=0 width="75%">
<tr height="10"></tr>
<tr valign="top" bgcolor =  "#client.color_appsubtitle#" >
<!---<CFIF LISTFINDNOCASE(VALUELIST(getRECORDDTL.FORMCODE_FK),"PX")>
<TD nowrap="nowrap" align="center" <CFIF THETABLE EQ "#GETRECORD.TKFILENAME_FK#PX"> bgcolor =  "#client.color_apptitle#"</CFIF> ><A href="#getfilefrompath(getbasetemplatepath())#?#URLVARIABLES#&t=#GETRECORD.TKFILENAME_FK#PX"> Attendance Exceptions </A></TD></CFIF>--->
<CFLOOP query="getEFORMS">
	<CFIF THETABLE EQ TABLENAME_FK>
		<CFSET THETITLE = DESCRIPTION>
		<CFSET THEPREPROCESS = PREPROCESS>
		<CFSET THEFORMCODE = FORMCODE>
		<TD nowrap="nowrap" align="center" bgcolor =  "#client.color_apptitle#"><A href="#getfilefrompath(getbasetemplatepath())#?#URLVARIABLES#&t=#TABLENAME_FK#"><font size="+1">#DESCRIPTION#</font></A></TD>
	</CFIF>
	<!---<TD nowrap="nowrap" align="center" <CFIF TABLENAME_FK EQ THETABLE> bgcolor =  "#client.color_apptitle#" </CFIF> ><A href="#getfilefrompath(getbasetemplatepath())#?#URLVARIABLES#&t=#TABLENAME_FK#"> #DESCRIPTION# </A></TD>--->
</CFLOOP>
</CFOUTPUT> 
</tr>
</table>
<CFOUTPUT>
<!---VALIDATE TABLENAME IN THE URL FOR SECURITY PURPOSES--->
<CFIF NOT LISTFINDNOCASE(VALUELIST(getEFORMS.TABLENAME_FK),THETABLE) AND THETABLE NEQ "#GETRECORD.TKFILENAME_FK#PX">
	<table border=0 cellspacing=1 cellpadding=0 width="75%">
		<TR height="25"></TR>
		<tr bgcolor="#CLIENT.COLOR_TBLHEAD#" valign="top">
			<TD align="center"><font color="FF0000"><STRONG>ILLEGAL ACCESS DETECTED. PLEASE USE THE STANDARD INTERFACE. YOU WILL BE REPORTED FOR ILLEGAL ACCESS.</STRONG></font></TD></tr>
	</table>
	<CFABORT>
<cfelseif NOT LISTFINDNOCASE(VALUELIST(getrecorddtl.formcode_fk),"PX") and THETABLE eq "#GETRECORD.TKFILENAME_FK#PX">
	<table border=0 cellspacing=1 cellpadding=0 width="75%">
		<TR height="25"></TR>
		<tr bgcolor="#CLIENT.COLOR_TBLHEAD#" valign="top">
			<TD align="center"><font color="FF0000"><STRONG>ILLEGAL ACCESS DETECTED. PLEASE USE THE STANDARD INTERFACE. YOU WILL BE REPORTED FOR ILLEGAL ACCESS.</STRONG></font></TD></tr>
	</table>
	<CFABORT>
</CFIF>
<CFMODULE template="#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TITLE = "#THETITLE# during the attendance cut-off">
<CFIF THETABLE NEQ "#GETRECORD.TKFILENAME_FK#PX">
	<CFQUERY NAME = "getDATEFIELD" datasource="#CLIENT.COMPANY_DSN#" maxrows="1">
		SELECT DATEFIELD
		FROM ECRGDTRDTL
		WHERE EDTRCODE = <cfqueryparam value="#EDTRCODE#" cfsqltype="cf_sql_varchar"> AND FORMCODE_FK IN
			(SELECT FORMCODE FROM ECRGFORMS WHERE TABLENAME_FK = <cfqueryparam value="#THETABLE#" cfsqltype="cf_sql_varchar">)
	</CFQUERY>
	<CFQUERY NAME = "getBROWSEFIELDS" datasource="#CLIENT.GLOBAL_DSN#">
		SELECT TABLENAME,COLUMNNAME,COLUMNTYPE,COLUMNDESC,FIELDGROUP,DEFAULTVALUE,COLUMNREQUIRED
		FROM GRGBOSETABLEFIELDS
		WHERE TABLENAME = <cfqueryparam value="#THETABLE#" cfsqltype="cf_sql_varchar">
			AND ISVISIBLEEFORM = 'Y'
		ORDER BY COLUMNORDER
	</CFQUERY>

	<CFIF STRUCTKEYEXISTS(URL,"DELETE")>
		<cfset url.delete = decrypt(url.delete,client.ek)>
		<CFQUERY name="delREC" datasource="#CLIENT.COMPANY_DSN#">
			DELETE FROM #THETABLE#
			WHERE DOCNUMBER = '#URL.DELETE#'
				AND PERSONNELIDNO = '#PID#'
		</CFQUERY>
		<CFQUERY name="delECINDTRUPDATEDTL" datasource="#CLIENT.COMPANY_DSN#">
			DELETE FROM ECINDTRUPDATEDTL
			WHERE DOCNUMBER = '#THEDOCNUMBER#'
				AND PID = '#PID#'
				AND FORMCODE_FK = '#THEFORMCODE#'
				AND DOCNUMBER_FK = '#url.delete#'
		</CFQUERY>
	</CFIF>
	<CFQUERY name="getCOLUMNS" datasource="#CLIENT.GLOBAL_DSN#">
		SELECT COLUMNNAME
		FROM GRGBOSETABLEFIELDS
		WHERE TABLENAME ='#THETABLE#'
	</CFQUERY>
	<cfsetting enablecfoutputonly="yes">
	<CFQUERY NAME = "getCONTENTS" datasource="#CLIENT.COMPANY_DSN#">
		SELECT *
		FROM #THETABLE#
		WHERE PERSONNELIDNO = '#PID#' 
		<CFSET FIRST = TRUE>
		<CFSET WITHPREVIOUS = FALSE>
		<CFLOOP LIST = "#GETDATEFIELD.DATEFIELD#" index="DF">
			<CFIF LISTFINDNOCASE(VALUELIST(GETCOLUMNS.COLUMNNAME),"#DF#") AND FIRST>
			AND(
			</CFIF>
			<CFIF LISTFINDNOCASE(VALUELIST(GETCOLUMNS.COLUMNNAME),"#DF#")>
				<CFIF WITHPREVIOUS>OR</CFIF>
			(#DF# >= '#dCUTOFFSTART#' AND #DF# <= '#dCUTOFFEND#')
				<CFSET WITHPREVIOUS = TRUE>
				<CFSET FIRST = FALSE>
			</CFIF>
		</CFLOOP>
		<CFIF NOT FIRST>)</CFIF>		
	</CFQUERY>
	<CFSETTING enablecfoutputonly="no">
<table border=0 cellspacing=1 cellpadding=0 width="90%">
	<tr bgcolor="#CLIENT.color_grphead#" valign="top">
		<TD align="center"></TD>
		<TD align="center"><strong>STATUS</strong></TD>
		<CFLOOP QUERY ="getBROWSEFIELDS">
		<TD align="center"><strong>#COLUMNDESC#</strong></TD>
		</CFLOOP>
	</TR>
	<CFLOOP query="getCONTENTS">
		<CFSET AROW = CURRENTROW>
		<tr bgcolor="#IIf(CurrentRow Mod 2, "client.color_tblset2", "client.color_tblset1")#" valign="top">
		<CFSWITCH expression="#APPROVED#">
			<CFCASE value="Y">
				<TD align="center"></TD>
				<TD align="center">APPROVED</TD>
			</CFCASE>
			<CFCASE value="N">
				<TD align="center"></TD>
				<TD align="center">DISAPPROVED</TD>
			</CFCASE>
			<CFCASE value="C">
				<TD align="center"></TD>
				<TD align="center">APPROVED</TD>
			</CFCASE>
			<CFCASE value="S">
				<TD align="center"></TD>
				<TD align="center">PENDING</TD>
			</CFCASE>
			<CFDEFAULTCASE>
				<TD align="center"><A href="#getfilefrompath(getbasetemplatepath())#?#URLVARIABLES#&t=#THETABLE#&edit=#DOCNUMBER#">edit</A>&nbsp;&nbsp;&nbsp; <A href="#getfilefrompath(getbasetemplatepath())#?#URLVARIABLES#&t=#THETABLE#&delete=#urlencodedformat(encrypt("#DOCNUMBER#",client.ek))#" onClick="javascript: return confirm('are you sure you want to delete this record?')">delete</A></TD>
				<TD align="center">NOT YET ROUTED</TD>
			</CFDEFAULTCASE>
		</CFSWITCH>
		<CFLOOP QUERY = "getBROWSEFIELDS">
			<CFIF COLUMNTYPE NEQ "ftDateTime">
				<TD align="center">#EVALUATE("GETCONTENTS.#COLUMNNAME#[AROW]")#</TD>
			<CFELSE>
				<TD align="center">#DATEFORMAT(EVALUATE("GETCONTENTS.#COLUMNNAME#[AROW]"))#</TD>
			</CFIF>
		</CFLOOP>
		</TR>
	</CFLOOP>
	<CFOUTPUT>
	<TR height="10"></TR><!---<TR><TD colspan="100"><A HREF="./gui_summary.cfm?#urlvariables#&t=#THETABLE#"<!---"#getfilefrompath(getbasetemplatepath())#?#URLVARIABLES#&t=#THETABLE#&rs="---> <!---onClick="javascript: window.open('./gui_summary.cfm?#URLVARIABLES#&t=#THETABLE#',
'fullscreen = yes,ScrollBars=Yes,Resizable=Yes');"--->> view/download summary report </A></TD></TR>--->
	</CFOUTPUT>
</table>
<CFELSE>
	<CFIF STDB NEQ "">
	<!---<cfif structkeyexists(form,"btnnewappPX")>
		<cfinclude template="func_savenewapppx.cfm">
	</cfif>--->
	<CFQUERY NAME = "getCONTENTS" datasource="#sTDB#">
		SELECT *
		FROM #GETRECORD.TKFILENAME_FK#PX
		WHERE PERSONNELIDNO = '#PID#'
	</CFQUERY>
	<table border=0 cellspacing=1 cellpadding=0 width="50%">
	<tr bgcolor="#CLIENT.color_grphead#" valign="top">
		<TD align="center"><strong>REFERENCE DATE</strong></TD>
		<TD align="center"><strong>PAIRTIME</strong></TD>
		<TD align="center"><strong>SWIPETYPE</strong></TD>
		<TD align="center"><strong>REMARKS</strong></TD>
	</TR>
	<CFLOOP query="getCONTENTS">
		<CFSET AROW = CURRENTROW>
		<tr bgcolor="#IIf(CurrentRow Mod 2, "client.color_tblset2", "client.color_tblset1")#" valign="top">
		<CFLOOP LIST = "REFERENCEDATE,PAIRTIME,SWIPETYPE,REMARKS" index="THEFIELD">
			<CFIF THEFIELD NEQ "REFERENCEDATE">
				<TD>#EVALUATE("GETCONTENTS.#THEFIELD#[AROW]")#</TD>
			<CFELSE>
				<TD>#DATEFORMAT(EVALUATE("GETCONTENTS.#THEFIELD#[AROW]"))#</TD>
			</CFIF>
		</CFLOOP>
		</TR>
	</CFLOOP>
	<CFELSE>
		TK FILE NOT FOUND.
	</CFIF>
	</table>
</CFIF>
<CFMODULE template="#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TOP="FALSE">
</CFOUTPUT>
<CFIF STRUCTKEYEXISTS(FORM,"btnSAVELINKS")>
	<CFINCLUDE template="func_savelinks.cfm">
</CFIF>
<CFIF THETABLE NEQ "#GETRECORD.TKFILENAME_FK#PX">
	<CFQUERY name="qryECINDTRUPDATEDTL" datasource="#CLIENT.COMPANY_DSN#">
		SELECT DOCNUMBER,FORMCODE_FK,DOCNUMBER_FK
		FROM ECINDTRUPDATEDTL
		WHERE DOCNUMBER = '#THEDOCNUMBER#'
			AND FORMCODE_FK = '#THEFORMCODE#'
			AND PID = '#PID#'
	</CFQUERY>
	<CFQUERY name="getTABLEFROMFORMCODE" datasource="#CLIENT.COMPANY_DSN#">
		SELECT TABLENAME_FK
		FROM ECRGFORMS
		WHERE FORMCODE IN (#QUOTEDVALUELIST(getRECORDDTL.FORMCODE_FK)#)
	</CFQUERY>
<CFELSE>
	<CFQUERY name="qryECINDTRUPDATEDTL" datasource="#CLIENT.COMPANY_DSN#">
		SELECT DOCNUMBER,FORMCODE_FK,DOCNUMBER_FK
		FROM ECINDTRUPDATEDTL
		WHERE DOCNUMBER = '#THEDOCNUMBER#'
			AND FORMCODE_FK = '#THETABLE#'
	</CFQUERY>
</CFIF>
<CFMODULE template="#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TITLE = "Linked Applications">
	<CFOUTPUT>
	<CFIF THETABLE NEQ "#GETRECORD.TKFILENAME_FK#PX">
		<CFIF STRUCTKEYEXISTS(FORM,"btnNEWAPP") OR STRUCTKEYEXISTS(URL,"EDIT") or STRUCTKEYEXISTS(URL,"newapp") and not structkeyexists(form,"btnsavenewapp")>
			<CFINCLUDE template="gui_newapp.cfm">
			<CFABORT>
		<CFELSEIF STRUCTKEYEXISTS(FORM,"btnEDITLINKS")>
			<CFINCLUDE template="gui_editlinks.cfm">
			<CFABORT>
		<CFELSEIF STRUCTKEYEXISTS(FORM,"btnROUTING")>
			<CFQUERY NAME="getROUTINGFORM" DATASOURCE="#CLIENT.COMPANY_DSN#">
				SELECT FORMCODE, TEMPLATECODE_FK 
				FROM ECRGFORMS WITH (NOLOCK)
				WHERE TABLENAME_FK = 'ECINDTRUPDATE'
			</CFQUERY>
			<CFQUERY NAME="getROUTINGFORMTEMPLATE" DATASOURCE="#CLIENT.GLOBAL_DSN#">
				SELECT TEMPLATEPATH 
				FROM EGRGTEMPLATES WITH (NOLOCK)
				WHERE TEMPLATECODE = '#getROUTINGFORM.TEMPLATECODE_FK#'
			</CFQUERY>
			<CFIF getROUTINGFORM.RECORDCOUNT>
				<CFPARAM NAME = "sMESS" default="">
				<CFSET sAnchor = "?id=" & "#URLENCODEDFORMAT(encrypt("#getROUTINGFORM.FORMCODE#", client.ek))#" & "&DOCNUMBER=#THEDOCNUMBER#&edit=1&smess=#smess#">
				<CFLOCATION url="#CLIENT.DOMAIN##getROUTINGFORMTEMPLATE.TEMPLATEPATH##sAnchor#"  ADDTOKEN="No">
			</CFIF>
		</CFIF>
		<FORM name="LINKEDAPPS" method="post" action="#getfilefrompath(getbasetemplatepath())#?#URLVARIABLES#&t=#THETABLE#">
			<INPUT type="submit"  name="btnEDITLINKS" value="Select applications">
			<INPUT type="submit"  name="btnNEWAPP" value="New application">
			<INPUT type="submit"  name="btnROUTING" value="Save eDTR for Routing">
		</FORM>
		<table border=0 cellspacing=1 cellpadding=0 width="75%">
		<CFIF qryECINDTRUPDATEDTL.RECORDCOUNT>
			<tr bgcolor="#CLIENT.color_grphead#" valign="top">
				<CFLOOP QUERY ="getBROWSEFIELDS">
					<TD align="center"><strong>#COLUMNDESC#</strong></TD>
				</CFLOOP>
			</TR>
			<CFLOOP query="qryECINDTRUPDATEDTL">
				<CFSET AROW = CURRENTROW>
				<CFQUERY name="getEFORM#AROW#" datasource="#CLIENT.COMPANY_DSN#">
					SELECT #VALUELIST(GETBROWSEFIELDS.COLUMNNAME)#
					FROM #THETABLE#
					WHERE DOCNUMBER = '#DOCNUMBER_FK#'
				</CFQUERY>
				<tr bgcolor="#IIf(CurrentRow Mod 2, "client.color_tblset2", "client.color_tblset1")#" valign="top">
					<CFLOOP QUERY = "getBROWSEFIELDS">
						<CFIF COLUMNTYPE NEQ "ftDateTime">
							<TD align="center">#EVALUATE("GETEFORM#AROW#.#COLUMNNAME#")#</TD>
						<CFELSE>
							<TD align="center">#DATEFORMAT(EVALUATE("GETEFORM#AROW#.#COLUMNNAME#"))#</TD>
						</CFIF>
					</CFLOOP>
				</TR>
			</CFLOOP>
			</table>
		</CFIF>
	<CFELSE>
		<CFIF STDB NEQ "">
			<CFIF STRUCTKEYEXISTS(FORM,"btnEDITLINKS")>
				<CFINCLUDE template="gui_editlinks.cfm">
				<CFABORT>
			<!---<cfelseif structkeyexists(url,"newapp") and not structkeyexists(form,"btnnewapppx") >--->
			<cfelseif structkeyexists(form,"btngo") >
				<cfinclude template="gui_newapppx.cfm">
				<cfabort>
			<CFELSEIF STRUCTKEYEXISTS(FORM,"btnROUTING")>
				<CFQUERY NAME="getROUTINGFORM" DATASOURCE="#CLIENT.COMPANY_DSN#">
					SELECT FORMCODE, TEMPLATECODE_FK 
					FROM ECRGFORMS WITH (NOLOCK)
					WHERE TABLENAME_FK = 'ECINDTRUPDATE'
				</CFQUERY>
				<CFQUERY NAME="getROUTINGFORMTEMPLATE" DATASOURCE="#CLIENT.GLOBAL_DSN#">
					SELECT TEMPLATEPATH 
					FROM EGRGTEMPLATES WITH (NOLOCK)
					WHERE TEMPLATECODE = '#getROUTINGFORM.TEMPLATECODE_FK#'
				</CFQUERY>
				<CFIF getROUTINGFORM.RECORDCOUNT>
					<CFPARAM NAME = "sMESS" default="">
					<CFSET sAnchor = "?id=" & "#URLENCODEDFORMAT(encrypt("#getROUTINGFORM.FORMCODE#", client.ek))#" & "&DOCNUMBER=#THEDOCNUMBER#&edit=1&smess=#smess#">
					<CFLOCATION url="#CLIENT.DOMAIN##getROUTINGFORMTEMPLATE.TEMPLATEPATH##sAnchor#"  ADDTOKEN="No">
				</CFIF>
			</CFIF>
			<FORM name="LINKEDAPPS" method="post">
				<INPUT type="submit"  name="btnEDITLINKS" value="Select exceptions">
				<INPUT type="submit"  name="btnROUTING" value="Save eDTR for Routing">
			</FORM>
			<table border=0 cellspacing=1 cellpadding=0 width="75%">
			<CFIF qryECINDTRUPDATEDTL.RECORDCOUNT>
				<tr bgcolor="#CLIENT.color_grphead#" valign="top">
					<TD align="center"><strong>REFERENCE DATE</strong></TD>
					<TD align="center"><strong>PAIRTIME</strong></TD>
					<TD align="center"><strong>SWIPETYPE</strong></TD>
					<TD align="center"><strong>REMARKS</strong></TD>
				</TR>
				<CFLOOP query="qryECINDTRUPDATEDTL">
					<CFSET AROW = CURRENTROW>
					<CFQUERY NAME = "getTHECONTENTS" datasource="#sTDB#">
						SELECT *
						FROM #GETRECORD.TKFILENAME_FK#PX
						WHERE PERSONNELIDNO = '#PID#'
							AND SEQUENCENO =  '#LISTGETAT("#qryECINDTRUPDATEDTL.DOCNUMBER_FK[AROW]#",1)#'
					</CFQUERY>
					<tr bgcolor="#IIf(CurrentRow Mod 2, "client.color_tblset2", "client.color_tblset1")#" valign="top">
					<CFLOOP LIST = "REFERENCEDATE,PAIRTIME,SWIPETYPE,REMARKS" index="THEFIELD">
						<CFIF THEFIELD NEQ "REFERENCEDATE">
							<CFIF THEFIELD NEQ "SWIPETYPE">
							<TD>#EVALUATE("GETTHECONTENTS.#THEFIELD#")#</TD>
							<CFELSE>
							<TD>#LISTGETAT("#QRYECINDTRUPDATEDTL.DOCNUMBER_FK[AROW]#",2)#</TD>
							</CFIF>
						<CFELSE>
							<TD>#DATEFORMAT(EVALUATE("GETTHECONTENTS.#THEFIELD#"))#</TD>
						</CFIF>
					</CFLOOP>
					</tr>
				</CFLOOP>
				</table>
			</CFIF>
		<cfelse>
				TK FILE NOT FOUND.
		</CFIF>
	</CFIF>
	</CFOUTPUT>
<CFMODULE template="#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TOP="FALSE">
<!---<cfif structkeyexists (url,"newapp") or structkeyexists (form,"btnSAVENEWAPP") or structkeyexists (url,"delete")>
	<cflocation url="./index.cfm?#urlvariables#" addtoken="no">
</cfif>--->
<!---<CFOUTPUT>
<CFIF STRUCTKEYEXISTS(URL,"rs")>
	<CFMODULE template="#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TITLE="#THETITLE# (Summary Report)">
	<cfinclude template="./gui_summary.cfm">
	<CFMODULE template="#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TOP="FALSE">
</CFIF>
</CFOUTPUT>--->
<CFMODULE TEMPLATE="#client.common_path#cfm_workspace.cfm" TOP = "FALSE">
</body>